package edu.snake.implement.command;

import edu.snake.core.controller.command.Algorithm;
import edu.snake.implement.controller.character.BaseCharacterController;
import edu.snake.implement.command.AbstractCommand;


public class Sleep extends AbstractCommand implements Algorithm {

    private int millis;

    public Sleep(BaseCharacterController controller, int millis) {
        super(controller);
        this.millis = millis;
    }

    @Override
    public void action() {
        Thread thread = Thread.currentThread();
        try {
            thread.sleep(millis);
        } catch (InterruptedException e) {
            controller.stop();
            e.printStackTrace();
        }
    }
}
